/**
 * 
 */
package com.platform.common.utils.excel;

import java.util.List;

import org.apache.poi.hssf.usermodel.HSSFRow;

/**
 * 抽象父类，完成基本默认配置
 * @author wei.gao
 */
public abstract class AbsExcelExportConfig<T> implements IExcelExportConfig<T> {
	boolean hasNext = true;
	Integer pageIndex = 0;
	
	/* (non-Javadoc)
	 * @see com.yueke.virgo.content.context.base.IExcelExportConfig#getSheetName()
	 */
	public String getSheetName(){
		// 默认第一个Sheet
		return "Sheet1";
	}

	/* (non-Javadoc)
	 * @see com.yueke.virgo.content.context.base.IExcelExportConfig#getExcelHead()
	 */
	public abstract List<String> getExcelHead();

	/* (non-Javadoc)
	 * @see com.yueke.virgo.content.context.base.IExcelExportConfig#getData()
	 */
	public abstract List<T> getData(int pageSize);

	/* (non-Javadoc)
	 * @see com.yueke.virgo.content.context.base.IExcelExportConfig#hasNext()
	 */
	@Override
	public boolean hasNext() {
		return hasNext;
	}
	
	/* (non-Javadoc)
	 * @see com.yueke.virgo.content.context.base.IExcelExportConfig#getPageIndex()
	 */
	@Override
	public int getPageIndex() {
		return pageIndex ++;
	}
	
	/* (non-Javadoc)
	 * @see com.yueke.virgo.content.context.base.IExcelExportConfig#getPageSize()
	 */
	@Override
	public int getPageSize() {
		// 默认100条一页
		return 100;
	}

	/* (non-Javadoc)
	 * @see com.yueke.virgo.content.context.base.IExcelExportConfig#renderRow(org.apache.poi.hssf.usermodel.HSSFRow, java.lang.Integer, java.lang.Integer, java.lang.Object)
	 */
	public abstract RenderResult renderRow(HSSFRow row, Integer rowInd, Integer colInd, T entity);
}
